<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>伪类选择器</title>
  <style>
    div:first-child{
      background-color: red;
    }
    div:last-child{
      background-color: blue;
    }
    p:first-child{
        background-color: red;
    }
    p:last-child{
        background-color: blue;
    }
  </style>
</head>
<body>
<p>passage</p>
<div>div1</div>
<div>div2</div>
<div>div3</div>
<div>div4</div>
<p>passage</p>
</body>
</html>